package com.gayworld.model.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.gayworld.model.noentity.ActionType;

@Entity
@Table(name = "action")
public class Action {
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	private Integer id;
	 
	 
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name="placeId")
	@JsonBackReference
	private Places place;
	  
		
	@Column(name = "petitionReason",  nullable = false)
	private String petitionReason;
	
	@Column(name = "resultReason")
	private String resultReason;
		
	@Temporal(TemporalType.DATE)
	@Column(name = "registerDate", nullable = false)
	private Date registerDate;

	@Temporal(TemporalType.DATE)
	@Column(name = "executedDate" )
	private Date executedDate;

	
	@Column(name = "emailRequest")
	private String emailRequest;
	

	@Column(name = "userIp")
	private String userIp;
	
	@Column(name = "petitionType")
	@Enumerated(EnumType.STRING) 
	private ActionType petitionType;
	
	@Column(name = "resultType")
	@Enumerated(EnumType.STRING) 
	private ActionType resultType;

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the place
	 */
	public Places getPlace() {
		return place;
	}

	/**
	 * @param place the place to set
	 */
	public void setPlace(Places place) {
		this.place = place;
	}
 
 
	/**
	 * @return the registerDate
	 */
	public Date getRegisterDate() {
		return registerDate;
	}

	/**
	 * @param registerDate the registerDate to set
	 */
	public void setRegisterDate(Date registerDate) {
		this.registerDate = registerDate;
	} 

	/**
	 * @return the userIp
	 */
	public String getUserIp() {
		return userIp;
	}

	/**
	 * @param userIp the userIp to set
	 */
	public void setUserIp(String userIp) {
		this.userIp = userIp;
	}
 
	/**
	 * @return the emailRequest
	 */
	public String getEmailRequest() {
		return emailRequest;
	}

	/**
	 * @param emailRequest the emailRequest to set
	 */
	public void setEmailRequest(String emailRequest) {
		this.emailRequest = emailRequest;
	}

	/**
	 * @return the executedDate
	 */
	public Date getExecutedDate() {
		return executedDate;
	}

	/**
	 * @param executedDate the executedDate to set
	 */
	public void setExecutedDate(Date executedDate) {
		this.executedDate = executedDate;
	}

	/**
	 * @return the petitionReason
	 */
	public String getPetitionReason() {
		return petitionReason;
	}

	/**
	 * @param petitionReason the petitionReason to set
	 */
	public void setPetitionReason(String petitionReason) {
		this.petitionReason = petitionReason;
	}

	/**
	 * @return the resultReason
	 */
	public String getResultReason() {
		return resultReason;
	}

	/**
	 * @param resultReason the resultReason to set
	 */
	public void setResultReason(String resultReason) {
		this.resultReason = resultReason;
	}

	/**
	 * @return the petitionType
	 */
	public ActionType getPetitionType() {
		return petitionType;
	}

	/**
	 * @param petitionType the petitionType to set
	 */
	public void setPetitionType(ActionType petitionType) {
		this.petitionType = petitionType;
	}

	/**
	 * @return the resultType
	 */
	public ActionType getResultType() {
		return resultType;
	}

	/**
	 * @param resultType the resultType to set
	 */
	public void setResultType(ActionType resultType) {
		this.resultType = resultType;
	}

	//TODO falta user ID	
}
